package com.petadoption.serverclient.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.petadoption.serverclient.entity.Productlist;
import com.petadoption.serverclient.mapper.ProductlistMapper;
import com.petadoption.serverclient.service.IProductlistService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 汪仕杰
 * @since 2023-08-28
 */
@Service
public class ProductlistServiceImpl extends ServiceImpl<ProductlistMapper, Productlist> implements IProductlistService {

    @Resource
    private ProductlistMapper productlistMapper;

    @Override
    public int addProductList(Productlist productlist) {
        return productlistMapper.insert(productlist);
    }

    @Override
    public int updateProductList(Productlist productlist) {
        return productlistMapper.update(productlist, new UpdateWrapper<Productlist>().eq("productlist_id", productlist.getProductlistId()));
    }

    @Override
    public Productlist findProductlist(Integer productlistId) {
        return productlistMapper.selectById(productlistId);
    }
}
